define([], function(){
    var tpl = {};
    tpl.init = function (){
        var html = '';
        html += highRisk();
        return html;
    };
    tpl.init2 = function (){
        var html = '';
        html += anxiety();
        return html;
    };
    tpl.init3 = function (){
        var html = '';
        html += highRiskResult();
        return html;
    };
    tpl.init4 = function (){
        var html = '';
        html += postpartumResult();
        return html;
    };

    //问卷渲染
    var highRisk = function (){
        return '<script type="text/html" id="highRisk-tpl">'+
                '{{each data as row,i}}'+
                    '<div class="panel-box">'+
                            '<div class="panel-title">{{row.nameT}}</div>'+
                            '<div class="clearfix panel-list">'+
                                '{{each row.topic as value}}'+
                                    '<div>'+
                                        '<div class="left">'+
                                            '{{if value.id >= 10 }}'+
                                            '<label><input type="checkbox" value="{{value.id}}.{{value.name}}" name="{{i}}" score="{{value.score}}" id="{{value.id}}" {{if value.flag}} checked {{/if}}> {{value.id}}.{{value.name}}</label>' +
                                            '{{else}}'+
                                            '<label><input type="checkbox" value="{{value.id}}.{{value.name}}" name="{{i}}" score="{{value.score}}" id="{{value.id}}" {{if value.flag}} checked {{/if}}> 0{{value.id}}.{{value.name}}</label>' +
                                            '{{/if}}'+
                                        '</div>'+
                                        '<div class="right">{{value.score}}分</div>'+
                                    '</div>'+
                                '{{/each}}'+
                            '</div>'+
                    '</div>'+
                '{{/each}}'+
                '</script>'
    };
    var anxiety  = function (){
        return '<script type="text/html" id="anxiety-tpl">'+
            '{{each data as row}}'+
               '<div class="checkBox anxietyBox" id="{{row.id}}">'+
                    '<div class="topic"> {{row.id}}.{{row.name}}</div>'+
                        '<div class="clearfix">'+
                            '{{each row.answer as value}}'+
                                '<label><input type="radio" name="{{row.id}}" value="{{value.name}}" score="{{value.score}}" {{if value.flag}} checked {{/if}}/> {{value.name}}</label>'+
                            '{{/each}}'+
                        '</div>'+
                    '</div>'+
                '</div>'+
            '{{/each}}'+
            '</script>'
    };
    //结果展示：
    var highRiskResult = function (){
        return '<script type="text/html" id="highRiskResult-tpl">'+
                ' <div><p>共计 {{lens}} 项，{{scoresTotal}}分，属于{{level}}；</p>'+
                '{{if lens != 0}}<p>患者情况：</p>{{/if}}'+
                '{{each result as value}}'+
                '<p>{{value.ques}}；</p> '+
                '{{/each}}'+
                '</div>'+
            '</script>'
    };
    var postpartumResult = function (){
        return '<script type="text/html" id="postpartumResult-tpl">'+
            '<p>共计 {{lens}} 项，共{{scoresTotal}}分,{{level}}; </p>'+
            '</script>'
    };
    return tpl;
});